'use strict';

var mongoose = require('mongoose'),
    Schema = mongoose.Schema,
    baseController = require('../../../Base/server/controllers/BaseDoc.js');

var newModel = baseController.getBaseDocFields();
newModel.Barcode = {
    type: String,
    required: '请输入芯片ID',
    trim: true
};
newModel.ItemMasterCode = {
    type: String,
    required: '请输入料号',
    trim: true
};
newModel.ItemMasterName = {
    type: String,
    required: '请输入料品名称',
    trim: true
};
//质检状态
newModel.QCStatus = {
    type: Number
};
//部门名称
newModel.DepartmentName = {
    type: String,
    trim: true
};
//工位名称
newModel.WorkLocationName = {
    type: String,
    trim: true
};
//作业名称
newModel.WorkName = {
    type: String,
    trim: true
};
//异常类型，枚举
newModel.ExceptionType = {
    type: Number
};

//漏刷作业名称
newModel.MissingWorkName = {
    type: String,
    trim: true
};
//漏刷作业时间
newModel.MissingWorkDateTime = {
    type: Date,
    default: Date.now
};

//已读
newModel.IsRead = {
    type: Boolean
};

//扩展字段:
newModel.DescSeg1 = {
    type: String,
    default: '',
    trim: true
};
newModel.DescSeg2 = {
    type: String,
    default: '',
    trim: true
};

var newSchema = new Schema(newModel);
newSchema.index({Barcode: 1});
newSchema.index({IsRead: 1});

mongoose.model('ProcessException', newSchema, 'ProcessException');
